home *** CD-ROM | disk | FTP | other *** search
/ Night Owl 6 / Night Owl's Shareware - PDSI-006 - Night Owl Corp (1990).iso / 031a / wb613_01.zip / WN_IEMSG.C < prev    next >
C/C++ Source or Header  |  1991-03-15  |  2KB  |  74 lines

  1. /*
  2. ** The Window BOSS's Data Clerk
  3. ** Copyright (c) 1988 - Philip A. Mongelluzzo
  4. ** All rights reserved.
  5. **
  6. ** wn_iemsg - field input error message handler 
  7. **
  8. ** Copyright (c) 1988 - Philip A. Mongelluzzo
  9. ** All rights reserved.
  10. **
  11. */
  12.  
  13. #include "winboss.h"                    /* standard stuff */
  14.  
  15. /*
  16. ************
  17. * wn_ihmsg *
  18. ************
  19. */
  20.  
  21. /*
  22. ** wn_iemsg(msg)
  23. **
  24. **    (char *)   msg - pointer to message to be displayed.
  25. **
  26. ** RETURNS:
  27. **
  28. **    NULL if error, else TRUE
  29. **
  30. ** NOTES:
  31. **
  32. **  This routine should be modified or replaced with code to suit
  33. **  your the applications specific needs.  It hooks to wn_g????
  34. **  such that whenever the field validation fails wn_g???? calls wn_iemsg
  35. **  to display an error message for the field in question.  The hooks
  36. **  in wn_g????? are of the form:
  37. **
  38. **      if(validation failed) wn_iemsg(msg);
  39. **
  40. **  This routine displays a single line of text on the last line and
  41. **  waits for a key to be struck before returning to accept new data
  42. **  for the field in question.
  43. **
  44. **  The error message can be a maximum of 80 characters, and must
  45. **  not contain any formatting directives (\n\t...).
  46. **
  47. **  Some wn_g???? (i.e. wn_gtext) have no provision to vaildate
  48. **  data and therefore never attempt to call this routine.
  49. **  
  50. */
  51.  
  52. /*
  53. ************
  54. * wn_iemsg *
  55. ************
  56. */
  57.  
  58. wn_iemsg(msg)                           /* field input error message */
  59. char *msg;                              /* the message to display */
  60. {
  61. WINDOWPTR wn;                           /* a window for me */
  62.  
  63.   if(!strlen(msg)) return(TRUE);        /* no message - just return */
  64.   if(strlen(msg) > 80) return(NULL);    /* dont be foolish */
  65.   wn=wn_open(1000,(wni_mxrows-1),0,(int)strlen(msg),1,(RVIDEO),NVIDEO);
  66.   if(!wn) return(NULL);                 /* Huh??? */
  67.   wn_puts(wn,0,0,msg);                  /* display message */
  68.   v_getch();                            /* fetch response */
  69.   wn_close(wn);                         /* make message go away */
  70.   return(TRUE);                         /* all done */
  71. }
  72.  
  73. /* End */
  74.